package com.filldream.fastboot.base.request.pc.menu;

import com.filldream.fastboot.common.util.Assert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;


/**
 * @author RickSun && iFillDream
 * @version 1.0
 * @data 2020-05-24 9:00
 * @description AddMenuSTO
 */
@ApiModel("添加菜单-pc")
@Data
public class AddMenuSTO {

    @NotEmpty
    @ApiModelProperty(value = "菜单名称",required = true)
    private String name;

    @ApiModelProperty(value = "菜单编码",required = true)
    private String code;

    @NotNull
    @ApiModelProperty(value = "父级菜单ID",required = true)
    private Long parentId;

    @NotNull
    @ApiModelProperty(value = "是否是菜单 0-否 1-是",required = true)
    private Integer isMenu;

    @ApiModelProperty(value = "菜单跳转地址")
    private String menuUrl;

    @ApiModelProperty(value = "图标")
    private String icon;

    public void check(){
        if( isMenu.equals(0) ){
            Assert.isEmpty(code,"菜单编码不能为空");
        }else if( isMenu.equals(1) ){
            Assert.isEmpty(menuUrl,"菜单编码不能为空");
        }
    }

}
